UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zKWMQE78R4NauUUDFgYGvLTr3sWI3/5/RgKB/X7wyB8='
WHERE
key_id = 'c4a7abd1c6b188fdc01981eebf5369bccc0fd832c0e5394ca5160d99014078df'
AND (
token = 'zKWMQE78R4NauUUDFgYGvLTr3sWI3/5/RgKB/X7wyB8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)