UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KRpic9MUfP+h/83hVxbekCl8RoyybGx7QxK2mIni1KE='
WHERE
key_id = '0130adedf14c18d45d8cfc13c2cafe467d2852a5acf71c3679e6e68debc17bb8'
AND (
token = 'KRpic9MUfP+h/83hVxbekCl8RoyybGx7QxK2mIni1KE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)