UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7ch4VnKkmjbKeVoidvC53Cs1wMf0UJAOYxSEPdR/iFg='
WHERE
key_id = '90ce92fd14fff03987a266d24915afe2c07eeaad8548bb87d6b2582492253d54'
AND (
token = '7ch4VnKkmjbKeVoidvC53Cs1wMf0UJAOYxSEPdR/iFg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)