UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'huji9UUDeaOVgWVjm0JE5/+qLakZ+haQrjhjU+ZxH+s=' 
WHERE 
  key_id = 'c2f798ec2724c85f7c45768e93366ca669e9c9e8e3f89f3acd0befce0cff5858' 
  AND (
    token = 'huji9UUDeaOVgWVjm0JE5/+qLakZ+haQrjhjU+ZxH+s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027