UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nFHlO9pJhEIIiWhV0sUTsbfZwQaoRdQCrRBf+T/sh8o=' 
WHERE 
  key_id = '867aaae4f80f5b4f34ddd05e7d2b40f0b1ab7238e8d6a4d18665033dee410701' 
  AND (
    token = 'nFHlO9pJhEIIiWhV0sUTsbfZwQaoRdQCrRBf+T/sh8o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028