UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pVwtz7lpXmNGqS08bYQToLmb6E/ZYXhaFeAaLMo+wHY='
WHERE
key_id = '977f69d48f8eef9ec6f318f827ee06fb373240f0c73986c00d2062f9f12152d6'
AND (
token = 'pVwtz7lpXmNGqS08bYQToLmb6E/ZYXhaFeAaLMo+wHY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)