UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hPUIHy9wDyeOnvA+i3q/zN5GpB5A27fFUlyCrlA9D+A='
WHERE
key_id = '988db749ea71bf13d71e46fe13054c02866365690a8d217e8d5b2e062df18257'
AND (
token = 'hPUIHy9wDyeOnvA+i3q/zN5GpB5A27fFUlyCrlA9D+A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)