UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hi4lYxBXCJCVh/rhymBrmyOrDqQfdCtfNbWpX3hAQt4='
WHERE
key_id = '5db4b6038fcba73fbb45f29e4840f17ea9d46e0a4c8e6b016333eff7114e7c27'
AND (
token = 'hi4lYxBXCJCVh/rhymBrmyOrDqQfdCtfNbWpX3hAQt4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)