UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'syjAw0xTNYWnNOPd7PWnFC7Nro5tFNVSGCBc4UidQbs='
WHERE
key_id = '6bb67c7467822023daad74e5314ed2105ed42026c22bc59303dc247973e86e08'
AND (
token = 'syjAw0xTNYWnNOPd7PWnFC7Nro5tFNVSGCBc4UidQbs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)