UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wA6f+HkMwxis9+Pwt23nSiXbS+7H9GGc3lXlcpFNgik='
WHERE
key_id = 'e564f2f47546f14fbdfb47e1e1cc89dc8299fc8d96e2e37d9fb8c7d8826dcd8a'
AND (
token = 'wA6f+HkMwxis9+Pwt23nSiXbS+7H9GGc3lXlcpFNgik='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)