UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jGeWvntPz9zuw+pdv9uYU1XgL0s/NG8AAQhG70yJdtc='
WHERE
key_id = '80c498cee4b2c7bd321b9064a633ba0a57365ac9d4da859df392f9600fba385c'
AND (
token = 'jGeWvntPz9zuw+pdv9uYU1XgL0s/NG8AAQhG70yJdtc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)