UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'icm+HWEQPphjDkjUxodZ+lxro6kdNj1cp8cdbReLc10=' 
WHERE 
  key_id = '314c013132f21f97f5f76df38d8860cd6adf62a9be73314ee23e82ac02106a5b' 
  AND (
    token = 'icm+HWEQPphjDkjUxodZ+lxro6kdNj1cp8cdbReLc10=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023