UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bPeMpj0IT4XBDUeXe3GFoXXokR9LzRA5to82cw8kfX8=' 
WHERE 
  key_id = '0451c70c9a0cf6e9e5eae5c4bc1734332ff36a68c331957ef684b2b72c9986a4' 
  AND (
    token = 'bPeMpj0IT4XBDUeXe3GFoXXokR9LzRA5to82cw8kfX8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021