UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T0EbTqZfFs6x4oKAsxMao2JhX5M1eTgL2WhL2zKr9ro=' 
WHERE 
  key_id = 'c122cb1cb43063c700f18973d5a6e80a72559ac301ffdd97d86c5c07064600d5' 
  AND (
    token = 'T0EbTqZfFs6x4oKAsxMao2JhX5M1eTgL2WhL2zKr9ro=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021