UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PKrArrHjpI7WCfTYLfl601yxaRey5L/qW+gCIiCDCGw='
WHERE
key_id = 'a4c7a5c2a16df9cdc2c925eac42122c152f49e6fde544814e3cc9d0e53e46ce8'
AND (
token = 'PKrArrHjpI7WCfTYLfl601yxaRey5L/qW+gCIiCDCGw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)