UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ECPnV1Mi4fLSb6rgVYLR6NW0ytFDzOamxR2qYBWi34U=' 
WHERE 
  key_id = '4009badd79277d9574f72828921c13ef4cbd62df8443fb8117d9b88d53dac892' 
  AND (
    token = 'ECPnV1Mi4fLSb6rgVYLR6NW0ytFDzOamxR2qYBWi34U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038