UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'usPtBPYpM4Jchn9lk7fVQs6R3IvlOp2rf6WjJtu9h3g='
WHERE
key_id = '5f6e2019d9b5f2c13694de3ec522e369462fc13329e9b576ca7dd2ed33575a18'
AND (
token = 'usPtBPYpM4Jchn9lk7fVQs6R3IvlOp2rf6WjJtu9h3g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)