UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6zqDMI7OYzKyCwZYGNowV5TgaihYX5nnYEpf16UCZKc=' 
WHERE 
  key_id = 'd15c12cbc63c303586444d11d529c0e3ac91b797b54cc85742b00b3a3ed9a358' 
  AND (
    token = '6zqDMI7OYzKyCwZYGNowV5TgaihYX5nnYEpf16UCZKc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056