UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aVUKqRXgPtsFXgo6cn31Butq4FwLg88W8MwnVz+ebYQ='
WHERE
key_id = '12da474c58f5be4a7f163a7efc4d1977a62f27f0d7343947ec31249a42059dd7'
AND (
token = 'aVUKqRXgPtsFXgo6cn31Butq4FwLg88W8MwnVz+ebYQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)