UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'F30e4SFZprD7QOwXb3Fq55WaLB0qYQyjukrN8AmKAok=' 
WHERE 
  key_id = '2faddefeb6a94525c324c3d91c36237a5b94a721efa63662ffb3cba5f199093d' 
  AND (
    token = 'F30e4SFZprD7QOwXb3Fq55WaLB0qYQyjukrN8AmKAok=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029