UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9dWJ1LCQnptvZLnY0cKqPnGqKKb+tcnRJN/9Z0L0xHk='
WHERE
key_id = '521eedbe6e284d885fc6c16415f66f282d8665257d655d7d8af717f8a259bbec'
AND (
token = '9dWJ1LCQnptvZLnY0cKqPnGqKKb+tcnRJN/9Z0L0xHk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)