UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cCSEel3doHRQpy75ZSPQjfREWrkn2AjeZmIzvfo/+BQ=' 
WHERE 
  key_id = '47d807b588b17dd813b39fc87ef2eed2e57630934ce86ed91eef7b944411d29e' 
  AND (
    token = 'cCSEel3doHRQpy75ZSPQjfREWrkn2AjeZmIzvfo/+BQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042