UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Hy3GZMSgLqLe6KsH9OEjiz6rgsIrFVTKpbIQ0XAk9NI='
WHERE
key_id = 'a709dae673cb1ec5b5ce9881a185deffa09de6d2d1c68bbae1c8b690c3376faf'
AND (
token = 'Hy3GZMSgLqLe6KsH9OEjiz6rgsIrFVTKpbIQ0XAk9NI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)