UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Dv9IXwrT+bPv2r1dR85i5t+SboeOf6n84e+DqTQmnCM='
WHERE
key_id = 'f702594c9d86f4a31fe3b6777a855f73d8fe1c8405440b66d6266357ff760a58'
AND (
token = 'Dv9IXwrT+bPv2r1dR85i5t+SboeOf6n84e+DqTQmnCM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)