UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gQU36w5JoPQfmS3WBOQVWHgZjlOBNaq6MeDxAv59zQw=' 
WHERE 
  key_id = '2944a756aceefe0a0a159af584739b9da5dcc67799393f21182b4d429f0e87ef' 
  AND (
    token = 'gQU36w5JoPQfmS3WBOQVWHgZjlOBNaq6MeDxAv59zQw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023