UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f74pmvh3SULgSCln9RYe6T1zFuo3DykWMXTMsOKVI/Y=' 
WHERE 
  key_id = '30fa37ab44f901f2516196f57e2107fd028cae20069f7fbe5bd52fc62ee50481' 
  AND (
    token = 'f74pmvh3SULgSCln9RYe6T1zFuo3DykWMXTMsOKVI/Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054