UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CrtVeVbZF7hwalTCLdaepYE66Q8ZSzKZZYgp312qPQ8='
WHERE
key_id = 'dae2819d6dc5f1be244f099caa922b1e8f32e7b3cf0793501b8554457e42d52c'
AND (
token = 'CrtVeVbZF7hwalTCLdaepYE66Q8ZSzKZZYgp312qPQ8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)