UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oOrjxAx/HUUdWTxWiz+7/T8GHC9Oado5a4sno+N6Imc='
WHERE
key_id = 'db7ecf7c175927cd0909be8d53e2c3d29ffa0e16a5fb288fe6a862376e7ee0a4'
AND (
token = 'oOrjxAx/HUUdWTxWiz+7/T8GHC9Oado5a4sno+N6Imc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)