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

Query time 0.00026