UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HC4tpONciU+jEz0dLXIyvDQbpuf3a+AIRZxMbr3wKl4='
WHERE
key_id = 'f66c3800eb968a39e60b93f20656561914f553e0ed19f4693d58145dd9c7f392'
AND (
token = 'HC4tpONciU+jEz0dLXIyvDQbpuf3a+AIRZxMbr3wKl4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)