UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eiH9St89TedEcpqU0ajbWpyAuTqz2cRADtfM0zaZM4U=' 
WHERE 
  key_id = '5c6b4b22653e350ef3dbd36da535410e959bec67fafaf596381111bae70a977b' 
  AND (
    token = 'eiH9St89TedEcpqU0ajbWpyAuTqz2cRADtfM0zaZM4U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059