UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H9KNS2Td0HSc6XMw6BH3YugsBz+CEzi29W1n3pSO9xs=' 
WHERE 
  key_id = '3ce250187a748f8b89c05130b30e9177c1e7edf44d4ba3aee91b48dfb9f43399' 
  AND (
    token = 'H9KNS2Td0HSc6XMw6BH3YugsBz+CEzi29W1n3pSO9xs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036