UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mqejf1+l+2aj4cj/txRAH15dq18/yteMZf8rVSiFh1E=' 
WHERE 
  key_id = '882b4ef43ed7bffcaa3134ee9849001c61133bc7d74f4cb4df2f2a905bf2beaa' 
  AND (
    token = 'mqejf1+l+2aj4cj/txRAH15dq18/yteMZf8rVSiFh1E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026