UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lp9iIc5cgCBNH/rw9tq3YUd+KNWn+295Emp3M2EFY0A=' 
WHERE 
  key_id = '6a45459c4c83af7b64b8d0dbe01de417ba680eeddafe3ebb76740f24942dcaa3' 
  AND (
    token = 'lp9iIc5cgCBNH/rw9tq3YUd+KNWn+295Emp3M2EFY0A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032