UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JZKYThV4OtveZNYZB0PljU909tZg2GhI7BymvtzhvxY=' 
WHERE 
  key_id = 'bb26f3a28628f4236f7a9363d6b80519c524280d9de8f15b412c85dd023ebfd7' 
  AND (
    token = 'JZKYThV4OtveZNYZB0PljU909tZg2GhI7BymvtzhvxY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041