UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OqS8aqlwDIgX7WIJn1PnOikIfQpZIq8CS4h93iWlPxs='
WHERE
key_id = 'c4f3bb6307d242070a53509cc66ae1529c12e7d8f5c6b71501287b7130f91b4c'
AND (
token = 'OqS8aqlwDIgX7WIJn1PnOikIfQpZIq8CS4h93iWlPxs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)