UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BGcaAp+IuT65q4lMiA4UIJGc1GcYid+nORw9OMLczwk='
WHERE
key_id = 'e086e78add2a2172dc9aef7d35329030ab08e396df871d9244a0ccb7c8687ed9'
AND (
token = 'BGcaAp+IuT65q4lMiA4UIJGc1GcYid+nORw9OMLczwk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)