UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VNQcyMVJ3sY1/bNtB+faQ4MkIq+jv0FjUR8cHLPvtqE=' 
WHERE 
  key_id = 'ff07397f08c5f64a0de970b32171beb5089468a75c32af59373126110571ada8' 
  AND (
    token = 'VNQcyMVJ3sY1/bNtB+faQ4MkIq+jv0FjUR8cHLPvtqE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024