UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DjASyOQIOq6HntqgCmUyVTpO/+gkDap8K0kDqHpq8x0='
WHERE
key_id = '2a40f2a3279d80c614a9c06804728c855823886b1502e020043b421a9841dc61'
AND (
token = 'DjASyOQIOq6HntqgCmUyVTpO/+gkDap8K0kDqHpq8x0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)