UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1srgg5sO4gY9QyQH1cVrQzDrKzhHCpUPu1pVSUZZYRo='
WHERE
key_id = 'ed5b22e32445328e2208c26db9ac8f27bcfd10a210e5a1de1e5c92be9a8d1b7c'
AND (
token = '1srgg5sO4gY9QyQH1cVrQzDrKzhHCpUPu1pVSUZZYRo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)