UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BCfErHt+x7zwZkmFmB+6vOGWkZqzNX3e1/jz8Hnt3mg='
WHERE
key_id = 'cc23b60a1836401fcc325b3b534920557b21a810457b5e943aa9aae9702aeb9d'
AND (
token = 'BCfErHt+x7zwZkmFmB+6vOGWkZqzNX3e1/jz8Hnt3mg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)