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

Query time 0.00028