UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ErSwLR65cOPmNmwiqwLPYry8+HsTYy+DByHEMhYB7Mc='
WHERE
key_id = 'dfcc26f5e285b5dbfa488dc83918500d0fe0078ade1f765362130d508a49c10b'
AND (
token = 'ErSwLR65cOPmNmwiqwLPYry8+HsTYy+DByHEMhYB7Mc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)