UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZOpiCJ2ySjY7ICoUh8A8/nNiKbNaxEllF0tz2ee8f3g='
WHERE
key_id = '570f5e155c797878df00d9a8a419c33042a9796704af5b8492399e4d3640f9c2'
AND (
token = 'ZOpiCJ2ySjY7ICoUh8A8/nNiKbNaxEllF0tz2ee8f3g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)