UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S9/TwRWVqX2Q9YfpN+dCgf4SYeu/jQM7yw5/+IaluuI=' 
WHERE 
  key_id = '53270e554f2887d9367fb1bde6b781688ca50543982e9bcdfa5188093a1f1755' 
  AND (
    token = 'S9/TwRWVqX2Q9YfpN+dCgf4SYeu/jQM7yw5/+IaluuI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022