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