UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hWnrdkfnmrSJuTf4EIzIcEY/uyB/TM12wa8tMIoV8H0='
WHERE
key_id = 'b4322524a2a0e471034df615bc1c2f8ae60ee1c31834d78a2084b2e8e8c6b3c1'
AND (
token = 'hWnrdkfnmrSJuTf4EIzIcEY/uyB/TM12wa8tMIoV8H0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)