UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Y7XGXieJQoJmT2STx4dX7h3vTiS1PuZwDB/YKMYgqVc='
WHERE
key_id = 'a75e36695175a4b47aec269c5d73116d93c6cebec5586b8df0497eef9e6d8af6'
AND (
token = 'Y7XGXieJQoJmT2STx4dX7h3vTiS1PuZwDB/YKMYgqVc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)