UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0z74Y+JWI3cIte0Vl/dhCAiitOF/Y74TGc74Pr0IlZI='
WHERE
key_id = '8f3e7b8ec96d8de0f155e07871e3a58d838f07a4c69d682bfc7f6e71e794844b'
AND (
token = '0z74Y+JWI3cIte0Vl/dhCAiitOF/Y74TGc74Pr0IlZI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)