UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5u8LgmrivI1UNvCm/Ns9d8yF+3D87OyDQIWvPFnF4gI='
WHERE
key_id = 'ddb50add0150609471f611516168c15f468a38b7ed825a1896f720b93b5a75d8'
AND (
token = '5u8LgmrivI1UNvCm/Ns9d8yF+3D87OyDQIWvPFnF4gI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)