UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A0viakANWRK3R5glVVY+iJrmfeoIVO0yhszTkMA7bfw=' 
WHERE 
  key_id = 'e5fd7d69a3888b2d186340b7f6727eb30db7e34f4d48988a43c60297a5f05fa5' 
  AND (
    token = 'A0viakANWRK3R5glVVY+iJrmfeoIVO0yhszTkMA7bfw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021