UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NgPbb8LWWDS08nNk/d9R7fZpcv5x/ruz8QOEtPLLgB4='
WHERE
key_id = 'a58fa2961492a51b8d567589155afb5c7580ccbb42a3f504a35e98e9ec62efd2'
AND (
token = 'NgPbb8LWWDS08nNk/d9R7fZpcv5x/ruz8QOEtPLLgB4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)